package org.edu.modules.logistics.good.service.impl;

import org.edu.common.base.BasePageDto;
import org.edu.common.base.BaseServiceImpl;
import org.edu.common.utils.ConvertUtils;
import org.edu.common.base.BaseServiceImpl;
import org.edu.modules.logistics.good.dto.VeHqChurukuCount;
import org.edu.modules.logistics.good.mapper.VeHqChurukuMapper;
import org.edu.modules.logistics.good.entity.VeHqChuruku;
import org.edu.modules.logistics.good.dto.VeHqChurukuDto;
import org.edu.modules.logistics.good.service.VeHqChurukuService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 实现类
 */
@Service
public class VeHqChurukuServiceImpl extends BaseServiceImpl<VeHqChuruku, VeHqChurukuMapper> implements VeHqChurukuService {

    public IPage<VeHqChurukuDto> pageDto(BasePageDto page, @Param(Constants.WRAPPER) Wrapper queryWrapper){
        return mapper.pageDto(page,queryWrapper);
    }
    public IPage<VeHqChurukuCount> kcPageDto(BasePageDto page, @Param(Constants.WRAPPER) Wrapper queryWrapper){
        return mapper.kcPageDto(page,queryWrapper);
    }
    /**
    * 查询实体类
    */
    public VeHqChurukuDto findDtoById(String id) {
        VeHqChuruku entity = super.findById(id);
        VeHqChurukuDto dto = ConvertUtils.convertToDto(entity, VeHqChurukuDto.class);
        return dto;
    }

    /**
    * 新增或者修改
    */
    public void insertOrUpdate(VeHqChurukuDto dto,Boolean isAdd){
        if(isAdd){
            super.insert(dto);
        }else{
            super.update(dto);
        }
    }

    @Override
    @Transactional
    public void insertList(List<VeHqChurukuDto> dto) {
        super.insert(dto);
    }

}
